package edu.colorado.karl.intelsched;

import java.util.*;

/**
 * Class for transmitting data from the database to the Intelligent Scheduler.
 * @author Andrew Boehm
 */
public class ISInfo {
	private Double roomSetpoint;
	private Double roomSetAllowance;
	private Integer dayOfYear;
	private Integer hourOfDay;
	private Double roofTemp;
	

	/**
	 * Constructor that will use the current day and time for its timestamp.
	 * @param thisRoomSetpoint Current room temperature set point
	 * @param thisRoomSetAllowance Current range of room temperature set point.
	 * @param thisRoofTemp Current average temperature of roof sensors.
	 */
	public ISInfo(Double thisRoomSetpoint,
			Double thisRoomSetAllowance, Double thisRoofTemp)
	{
		roomSetpoint = thisRoomSetpoint;
		roomSetAllowance = thisRoomSetAllowance;
		roofTemp = thisRoofTemp;
		Calendar cal = Calendar.getInstance();
		dayOfYear = cal.get(Calendar.DAY_OF_YEAR);
		hourOfDay = cal.get(Calendar.HOUR_OF_DAY);
	}

	/**
	 * Constructor for using an explicitly specified day and time for its timestamp.
	 * @param thisRoomSetpoint Average room setpoint for the hour
	 * @param thisRoomSetAllowance Amount of degrees room could be above or below setpoint
	 * @param thisDayOfYear Day of year (Jan 1 = 1, Feb 1 = 32)
	 * @param thisHourOfDay Hour of day in 24 hour format
	 */
	
	public ISInfo(Double thisRoomSetpoint,
			Double thisRoomSetAllowance, Double thisRoofTemp,
			Integer thisDayOfYear, Integer thisHourOfDay)
	{
		this(thisRoomSetpoint, thisRoomSetAllowance, thisRoofTemp);
		dayOfYear = thisDayOfYear;
		hourOfDay = thisHourOfDay;
	}
	

	/**
	 * Returns the average room set point.
	 * @return average room set point for the hour.
	 */
	public Double getRoomSetpoint()
	{
		return roomSetpoint;
	}
	
	/**
	 * Returns the acceptable hysteresis for the room set point.
	 * @return Amount of degrees room could be above or below set point
	 */
	public Double getRoomSetAllowance()
	{
		return roomSetAllowance;
	}
	
	/**
	 * Returns the number of the day in a year that this <code>ISInfo</code> object
	 * was created. Jan 1 = 1, Feb 1 = 32, up to 365/366.
	 * @return the number of the day of year that this ISInfo object was obtained.
	 */
	public Integer getDayOfYear() 
	{
		return dayOfYear;
	}

	/**
	 * Returns the hour of the day that this <code>ISInfo</code> object was created for.
	 * The hour is returned in the 24 hour format.  Midnight is treated as "hour 0".
	 * @return the hour of day for this ISInfo object.
	 */
	public Integer getHourOfDay() 
	{
		return hourOfDay;
	}

	/**
	 * Returns the average temperature of all roof temperatures at the current time
	 * for the <code>ISInfo</code> object
	 * @return The average temperature across the roof.
	 */
	public Double getRoofTemp() {
		return roofTemp;
	}
}
